module.exports = {
  description: 'Create routing page',
  prompts: [
    {
      type: 'input',
      name: 'name',
      message: 'Please enter the routing file name',
      validate: (v) => {
        if (!v || v.trim === '') {
          return 'Route name cannot be empty'
        } else {
          return true
        }
      },
    },
  ],
  actions: (data) => {
    const actions = [
      {
        type: 'add',
        path: `src/views/{{camelCase name}}/Index.vue`,
        templateFile: 'plop-tpls/router/index.hbs',
        data: {
          componentName: `${data.name}`,
        },
      },
    ]
    return actions
  },
}
